package cn.tonyandmoney.voicenotes.notes.filters;

import cn.tonyandmoney.baidu.asr.entity.NluResult;
import cn.tonyandmoney.baidu.asr.model.AsrFilter;
import cn.tonyandmoney.voicenotes.notes.presenter.IOperation;

public abstract class BaseFilter extends AsrFilter {

    protected IOperation iOperation;

    public BaseFilter(IOperation iOperation) {
        this.iOperation = iOperation;
    }

    protected abstract String getDomain();

    protected abstract void operation(NluResult result);

    @Override
    protected boolean doFilter(NluResult result) {
        if (getDomain().equals(result.getDomain())) {
            operation(result);
            return true;
        }
        return false;
    }
}
